package com.cqcet.wenchuang.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

import java.util.ArrayList;

@Slf4j
@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfig {

    @Bean
    public Docket createRestApi() {
        log.info("Knife4j...");
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(createApiInfo());
    }

    @Bean
    public ApiInfo createApiInfo() {
        return new ApiInfo("文创商城" ,
                "文创商城API文档" ,
                "1.0.0" ,
                "https://gitee.com/shi-longqing/wenchuang_mall.git" ,
                new Contact("施龙青" , "" ,
                        "2053699418@qq.com"),
                "Apache 2.0" ,
                "http://www.apache.org/licenses/LICENSE-2.0" ,
                new ArrayList<>());
    }
}